/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.security.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.hera.base.domain.BaseDomain;
import com.hera.process.config.domain.ParameterDetail;
import com.hera.process.config.domain.Module;

/**
 *
 * @author cmontes
 */
@Entity
@Table(name = "SEC_GROUP_MODULE")
public class SecGroupModule extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SecGroupModulePK secGroupModulePK;
    @JoinColumn(name = "ID_SECURITY_GROUP", referencedColumnName = "ID_SECURITY_GROUP", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private SecurityGroup securityGroup;
    @JoinColumn(name = "ID_MODULE", referencedColumnName = "ID_PARAMETER_DETAIL", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private ParameterDetail module;

    public SecGroupModule() {
    }

    public SecGroupModule(SecGroupModulePK secGroupModulePK) {
        this.secGroupModulePK = secGroupModulePK;
    }

    public SecGroupModule(Long idSecurityGroup, Long idModule) {
        this.secGroupModulePK = new SecGroupModulePK(idSecurityGroup, idModule);
    }

    public SecGroupModulePK getSecGroupModulePK() {
        return secGroupModulePK;
    }

    public void setSecGroupModulePK(SecGroupModulePK secGroupModulePK) {
        this.secGroupModulePK = secGroupModulePK;
    }

    public SecurityGroup getSecurityGroup() {
        return securityGroup;
    }

    public void setSecurityGroup(SecurityGroup securityGroup) {
        this.securityGroup = securityGroup;
    }

    public ParameterDetail getModule() {
        return module;
    }

    public void setModule(ParameterDetail module) {
        this.module = module;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (secGroupModulePK != null ? secGroupModulePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof SecGroupModule)) {
            return false;
        }
        SecGroupModule other = (SecGroupModule) object;
        if ((this.secGroupModulePK == null && other.secGroupModulePK != null) || (this.secGroupModulePK != null && !this.secGroupModulePK.equals(other.secGroupModulePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.SecGroupModule[ secGroupModulePK=" + secGroupModulePK + " ]";
    }
    
}
